print("helloworld")
import keyword

# 打印所有关键字
print(keyword.kwlist)

a = 1
print(a)
# type 查看变量类型
print(type(a))
print("=" * 100)
a = "1"
print(type(a))

# 常量，业界规则
PI = 3.1415926

'''
多行注释
'''

"""
多行注释

"""

# sep  分隔符，end结尾，默认\n
print("数加", "java", sep=",", end="\t")
print("java")
print(1 + 1)

print("shujia")
print('shujia')
print("shu\"jia")
print('shu"jia')

print("shu\tjia")
# 前面加上r 字符串原样输出
print(r"shu\njia")

s = "数加科技"
# 切片   开始位置:结束位置:步长
print(s[0:2:1])
print(s[::])
print(s[::1])
print(s[::-1])

print(1 == 1)

print(True)
print(False)

print(True & False)
print(True and False)

print(True | False)
print(True or False)

print(not False)

print(None)
print(type(None))

a = 10
b = 3

print(a + b)
print(a - b)
print(a * b)
print(a / b)
print(a // b)
print(a ** b)

a = 10
s = str(a)
print(s, type(s))

a1 = int(s)
print(a1, type(a1))

# 类型转换异常
# s1 = "aaa"
# a2 = int(s1)
# print(a2)


print(bool(1))
print(bool(0))
print(bool(100))
print(bool(-100))

print(bool("a"))
print(bool("0"))
print(bool("False"))

a = 10
# 判断数据类型
print(isinstance(a, str))
print(isinstance(a, int))

a = 10
b = 0


# print(a / b)

# print(name)


# name = 'aaa'

# 自定义异常
class MyException(Exception):
    # 如果代码块什么都不写，需要加上pass
    pass


num = 3

try:
    print("异常发送之前")
    # print(10 / 0)

    # 手动抛出异常
    # raise ValueError("类型转换异常")

    raise MyException("自定义异常")

    print("异常发送之后")
except(TypeError):
    print("TypeError")
except(ZeroDivisionError):
    print("除零异常")
except(MyException):
    print("捕获自定义异常")
else:
    print("没有发送异常执行")
finally:
    print("都会执行")

import sys

print(sys.getdefaultencoding())

s = "中文"
s1 = s.encode("utf-8")
print(s1.decode("GBK"))

open("",encoding="")

